package com.xzxy.xmlg_backend.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: zys
 * @CreateTime: 2025-06-10
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    //成功的结果
    public static <T> Result<T> success(T data){
        return new Result<>(1,"操作成功",data);
    }

    public static <T> Result<T> success(){
        return Result.success(null);
    }

    public static <T> Result<T> fail(String msg){
        return new Result<>(0,msg,null);
    }

}
